
import {timer as observableTimer} from 'rxjs';
import { Component, OnInit, Renderer2, AfterViewInit } from '@angular/core';
import {FormGroup} from '@angular/forms';
import {FormlyFieldConfig, FormlyFormOptions} from '@ngx-formly/core';
//import { TreeNode } from '@shared/apes/form/tree-display/treenode';

@Component({
  selector: 'demo03',
  templateUrl: './demo03.component.html',
  styleUrls: ['./demo03.component.css']
})
export class Demo03Component implements OnInit, AfterViewInit {
  value: any;
  height = null;
  form = new FormGroup({});
  //selectedFile: TreeNode;
  TreeCommon=[{
    "id": 1,
    "label": "查询",
    "data": "树形查询 Uuohzh Uxhmbpx Nrtlosm Ihvjvc Zpb Nhbqd",
    "expandedIcon": "anticon-folder-open",
    "collapsedIcon": "anticon-folder",
    "children": [
      {
        "id": 10001,
        "label": "合同管理",
        "data": "合同管理 Pfunio Atkhv Ryxmm Xyidjxpqti Fmedcvdso",
        "expandedIcon": "anticon-folder-open",
        "collapsedIcon": "anticon-folder",
        "children": [
          {
            "id": 20001,
            "label": "采购合同管理",
            "data": "采购合同管理 Nst Bfyrlqjhbf Qqnfoqe Udvusxl Lwqs",
            "expandedIcon": "anticon-folder-open",
            "collapsedIcon": "anticon-folder",
            "children": [
              {
                "id": 30001,
                "label": "制定采购合同",
                "data": "制定采购合同 Tvlgdqrg Tdogvkhysl Tphscs Tqktovcdod",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40001,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Ilqkcztdr Nxxnvfbsa Yishhsnti",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50001,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50002,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50003,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40002,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Ecng Omabjkgfc Lvnp Bdpfyp Hzs Fbm Wpjidipsy",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50004,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50005,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50006,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40003,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Mwkpxexhm Sdcehgip Njmlshvd Jlfrlpe Sbjyc",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50007,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50008,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50009,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              },
              {
                "id": 30002,
                "label": "制定采购合同",
                "data": "制定采购合同 Cxfciqkno Yki Sqmtdg",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40004,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Mcna Fesctf Qrtdxqpsn Rwmhgjxdy",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50010,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50011,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50012,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40005,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Pxzcf Ukemmqewm Osqqqnw Usxi Ppixe",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50013,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50014,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50015,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "id": 10002,
        "label": "合同管理",
        "data": "合同管理 Nscfoutt Ouqdsbivs Lcek Hjzh Jnktjdyav",
        "expandedIcon": "anticon-folder-open",
        "collapsedIcon": "anticon-folder",
        "children": [
          {
            "id": 20002,
            "label": "采购合同管理",
            "data": "采购合同管理 Otytaur Vfmkhl Hnqretq Kjkeei Wyfjqwz Yijfrafb",
            "expandedIcon": "anticon-folder-open",
            "collapsedIcon": "anticon-folder",
            "children": [
              {
                "id": 30003,
                "label": "制定采购合同",
                "data": "制定采购合同 Odt Lyxmwdhoy Asbcnyapc Naedpcvi",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40006,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Poputt Pvqi Jnfxdhi Pbvjtk Cgf Wfvkjslgmb",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50016,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50017,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50018,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              },
              {
                "id": 30004,
                "label": "制定采购合同",
                "data": "制定采购合同 Hqruy Jufiydv Feto Thlfrbofg Krkbv",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40007,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Dtwp Jobmb Rrxplqn Vrsfeuim Labceku Iqdaqf Udkckyqzft",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50019,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50020,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50021,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              },
              {
                "id": 30005,
                "label": "制定采购合同",
                "data": "制定采购合同 Royvuk Jysttu Fhjwxec Fwhoogwumi",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40008,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Edizmd Whqumy Wduhqkcdv Rnesp",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50022,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50023,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50024,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40009,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Lnvehe Qylnlokcq Ahkknc Bagjzqxbsq Ohfq Fpgec",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50025,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50026,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50027,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "id": 10003,
        "label": "合同管理",
        "data": "合同管理 Embrh Haxpobbkmn Drkvu Twqiwvp",
        "expandedIcon": "anticon-folder-open",
        "collapsedIcon": "anticon-folder",
        "children": [
          {
            "id": 20003,
            "label": "采购合同管理",
            "data": "采购合同管理 Suvioh Dxeylgbb Tkusi Epfdmjafzp Yydfcjv",
            "expandedIcon": "anticon-folder-open",
            "collapsedIcon": "anticon-folder",
            "children": [
              {
                "id": 30006,
                "label": "制定采购合同",
                "data": "制定采购合同 Msfhtvceo Xgnjst Vucvteqq Beoemvihkw Mpdi Jcjpgdxt",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40010,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Xgcgteprpe Ipthfrxb Rigpato Ftlnmxjw Gyecdi Qxlaoy Lwupxcgqe",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50028,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50029,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50030,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40011,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Bceodkrwv Job Hmmlka Rspguvgtw Gqu",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50031,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50032,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50033,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40012,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Jenvfhaiqj Pchjwwll Lzhxkzvj Ksssdica Ilufct",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50034,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50035,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50036,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": 20004,
            "label": "采购合同管理",
            "data": "采购合同管理 Bhkoivgp Ieqls Mmrlxqccz",
            "expandedIcon": "anticon-folder-open",
            "collapsedIcon": "anticon-folder",
            "children": [
              {
                "id": 30007,
                "label": "制定采购合同",
                "data": "制定采购合同 Crfecmimcp Pzmr Gpakfe Crcod Cbqydffrly Ldqkzbwqi Quos",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40013,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Hxapje Iggwg Ybjqwissn Ivq Tcrx Uwcqire",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50037,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50038,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50039,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40014,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Xbemnqlnm Hhdw Fslisjjh Upqavvxjp",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50040,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50041,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50042,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              },
              {
                "id": 30008,
                "label": "制定采购合同",
                "data": "制定采购合同 Dwrgjjd Nbpxdtnmu Ekuxebgr Vdhhnfl Mfus Bjhwf",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40015,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Asgy Rkgk Jyioenq",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50043,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50044,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50045,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  },
                  {
                    "id": 40016,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Hmihxly Nydrxgq Vwvdndkyn Iibiul Wlulxoz Eecflh",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50046,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50047,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50048,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              },
              {
                "id": 30009,
                "label": "制定采购合同",
                "data": "制定采购合同 Dvjy Gjvpmp Xpqtwxgkab Ykoujikvg Ybnm Qdmshbl",
                "expandedIcon": "anticon-folder-open",
                "collapsedIcon": "anticon-folder",
                "children": [
                  {
                    "id": 40017,
                    "label": "制定采购协议",
                    "data": "制定采购协议 Por Mujsvqrq Fmfsrzmlf Pvlkj Rbqk",
                    "expandedIcon": "anticon-folder-open",
                    "collapsedIcon": "anticon-folder",
                    "children": [
                      {
                        "id": 50049,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50050,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      },
                      {
                        "id": 50051,
                        "label": "Expenses.doc",
                        "icon": "anticon-file-text",
                        "data": "Expenses Document"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }];

  model: any = {};
  options: FormlyFormOptions = {};
  feild1: FormlyFieldConfig[] = [{
      key: 'name',
      type: 'input',
      templateOptions: {
          label: '姓名',
          placeholder: 'Enter email',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'gsid',
      type: 'input',
      templateOptions: {
          label: '公司代码',
          placeholder: '请输入合同名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'gsmc',
      type: 'input',
      templateOptions: {
          label: '公司名称',
          placeholder: '请输入公司名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'bmmc',
      type: 'input',
      templateOptions: {
          label: '部门名称',
          placeholder: '请输入部门名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'startDate',
      type: 'date',
      templateOptions: {
          label: '开始时间',
          placeholder: '结束时间',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }];

  feild2: FormlyFieldConfig[] = [{
      key: 'khid',
      type: 'input',
      templateOptions: {
          label: '客户姓名',
          placeholder: 'Enter khid',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18,
      }
  }, {
      key: 'khmc',
      type: 'input',
      templateOptions: {
          label: '客户名称',
          placeholder: '请输入客户名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'hymc',
      type: 'textarea',
      templateOptions: {
          label: '会员名称',
          placeholder: '请输入会员名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      }
  }, {
      key: 'xszzmc',
      type: 'input',
      templateOptions: {
          label: '销售组织名称',
          placeholder: '请输入销售组织名称',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      },
    validators: {
      validation: ['ip'],
    },
  }, {
      key: 'ip',
      type: 'input',
      templateOptions: {
          label: 'IP Address (pattern = /(\d{1,3}\.){3}\d{1,3}/)',
          pattern: /(\d{1,3}\.){3}\d{1,3}/,
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18,
          keyup: function () {
              console.log('abc');
          }
      },
      validation: {
          messages: {
              pattern: (error, field: FormlyFieldConfig) => `"${field.formControl.value}" 不是一个有效得IP地址`,
          },
      },
  }, {
      key: 'marvel3',
      type: 'select',
      templateOptions: {
          label: '选择 name/value/group',
          // selectMode: "multiple",
          options: [],
          change: () => {
              console.log('点击事件');
          },
          divCol: 24,
          lblCol: 6,
          inputCol: 18
      },
      lifecycle: {
          onInit: (form, field) => {
              observableTimer(10000).subscribe(() => {
                  field.templateOptions.options = [
                      {label: 'Iron Man', id: 'iron_man', name :"aaa", test: "uuuu"},
                      {label: 'Captain America', id: 'captain_america', name :"bbb"},
                      {label: 'Black Widow', id: 'black_widow', name :"ccc", disabled: true},
                      {label: 'Hulk', id: 'hulk', name :"ddd"},
                      {label: 'Captain Marvel', id: 'captain_marvel', name :"fff"},
                  ];
              });
          }
      }

  }, {
      key: 'hobby',
      type: 'checkbox',
      templateOptions: {
          label: '接收通知',
          title: '是',
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18,
          click: () => {
              console.log('点击事件');
          }
      }
  }, {
      key: 'multicheckbox',
      type: 'multicheckbox',
      templateOptions: {
          label: '购买的险种',
          options : [
              {label: '划痕险', key: 'iron_man', vaule: 'iron_man', name: 'insurance1'},
              {label: '自燃险', key: 'captain_america', vaule: 'captain_america', name: 'insurance2'},
              {label: '第三者险', key: 'black_widow', vaule: 'black_widow', name: 'insurance3', disabled: true},
              {label: '玻璃险', key: 'hulk', vaule: 'hulk', name: 'insurance4'},
              {label: '第三者不急免赔', key: 'captain_marvel', vaule: 'captain_marvel', name: 'insurance5'}
          ],
          required: true,
          divCol: 24,
          lblCol: 6,
          inputCol: 18,
      }
  }];

  data = {
      renderData: [
          {
              col: 12,
              type: "tabs",
              title: "动态表单区域一",
              tabs: [
                  {
                      id: "a",
                      title: "操作日志一",
                      genre: "form",
                      fields: this.feild1
                  },
                  {
                      id: "b",
                      title: "操作日志二",
                      genre: "form",
                      fields: this.feild2
                  }
              ]
          }
      ]
  };

  data1 = {
      renderData: [
          {
              col: 12,
              id: "c",
              type: "panel",
              title: "人员信息",
              genre: "form",
              fields: [
                  {
                      key: 'avc',
                      type: 'input',
                      templateOptions: {
                          label: '公司代码',
                          placeholder: '请输入合同名称',
                          required: true,
                          divCol: 24,
                          lblCol: 8,
                          inputCol: 16
                      }
                  }, {
                      key: 'nvc',
                      type: 'input',
                      templateOptions: {
                          label: '公司名称',
                          placeholder: '请输入公司名称',
                          required: true,
                          divCol: 24,
                          lblCol: 8,
                          inputCol: 16
                      }
                  }, {
                      key: 'hgj',
                      type: 'input',
                      templateOptions: {
                          label: '部门名称',
                          placeholder: '请输入部门名称',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }, {
                      key: 'qw',
                      type: 'date',
                      templateOptions: {
                          label: '开始时间',
                          placeholder: '结束时间',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }


              ]
          },
          {
              col: 12,
              id: "c",
              type: "panel",
              title: "供应商信息",
              genre: "form",
              fields: [
                  {
                      key: 'avc',
                      type: 'input',
                      templateOptions: {
                          label: '公司代码',
                          placeholder: '请输入合同名称',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }, {
                      key: 'nvc',
                      type: 'input',
                      templateOptions: {
                          label: '公司名称',
                          placeholder: '请输入公司名称',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }, {
                      key: 'hgj',
                      type: 'input',
                      templateOptions: {
                          label: '部门名称',
                          placeholder: '请输入部门名称',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }, {
                      key: 'qw',
                      type: 'date',
                      templateOptions: {
                          label: '开始时间',
                          placeholder: '结束时间',
                          required: true,
                          divCol: 24,
                          lblCol: 4,
                          inputCol: 20
                      }
                  }


              ]
          }
      ]
  };


 dataArray = [this.data];
 dataArray1 = [this.data1];
  constructor(private renderer: Renderer2) { }

  node:any;

  ngOnInit() {


  }

  ngAfterViewInit(){
    const container = document.querySelector(".demo3-container");
    const height = container['offsetHeight'];
    this.renderer.setStyle(container, 'height', height + 'px');
  }
  // TreenodeUnselect(event) {
  //   console.log("未选中时调用");
  //   console.log(event);
  // }
  // TreenodeSelect(event) {
  //    this.node = event.node.data;
  //   console.log("选中时调用");
  //   console.log(this.selectedFile);
  // }

  onChange($event: any): void {
    console.log($event);
  }
}
